/**
 * Created by alice on 2016/7/9.
 */
/*
文献资料模块
 */
require.config({
    baseUrl:'../js',
    paths:{
        "getData":"Util/getData",
        "config":"common/config",
        "components":"common/components",
        "common":"common/common",
        "jquery":"lib/jquery.min",
        "layout":"lib/layoutDpi",
        "weui":"lib/jquery-weui.min",
        "wx":"lib/jweixin-1.0.0"
    },
    shim : {
        "components": { deps : ["jquery"] },
        "weui":{deps:["jquery"]}
    },
    deps:['layout','jquery','weui'],
    urlArgs: "v=" + (new Date()).getTime()//以禁用浏览器缓存,上线后注释掉
});
require(['jquery','getData','config','common','components','weui','wx'],function($,getData,config,common,components,weui,wx){
    console.log(weui);
    var gm=common.gm;
    var token=gm.para.get(window.location.href,"token");
    //$(window).on("hashchange",onHash);
    //填充数据
    function bindData(data){
        var arr = [];
        var _isy = (window.location.href.indexOf("#b") > 0);
        var tmp = '<li class="{contentType} isopen" contentUuid="{contentUuid}" favid="{favoriteUuid}">\
                    <a href="{url}">\
                        <div class="asbg">\
                            <div class="live">\
                                <img style="background:url("../imgs/loading.gif") no-repeat center;" class="lazy scrollLoading" src="{imgUrl}">\
                            </div>\
                            <div class="text">\
                                <div class="list_title collectionContentTitle">\
                                    <p>{contentTitle}</p>\
                                </div>\
                                <p class="contentcount time">\
                                    {collectNum}\
                                    {readNum}\
                                </p>\
                            </div>\
                        </div>\
                        <div class="clear"></div>\
                    </a>\
                    </li>';
        $(data).each(function(i,o){
            var imgstr=o.imageUrl;
            o.imgUrl = gm.common.isObjUsable(imgstr)?(imgstr.substr(0,7)=="http://"?imgstr:window._interfaceImgPath+""+imgstr):"/static/imgs/spimg.png";
            //是否收藏
            var isCollection=o.collect == true?1:0;
            var title= o.contentTitle.replace("?"," ");
            var desc= o.contentTitle.replace("?"," ");
            var img="group1"+o.imgUrl.split('group1')[1];
            var favoriteUuid= o.id;

            var str="isCollection="+isCollection+"&title="+title+"&desc="+desc+"&img="+img+"&favoriteUuid="+favoriteUuid+"&token="+token+"&collectRule=0&contentType=0";

            o.url = o.contentType=="3"?o.contentUrl+"&"+str:'informationfordetails.html?client=ios&'+str;

            var readNum= o.readNum;
            if(!gm.common.isObjUsable(readNum))
                o.readNum="<span style='margin-right:.5rem;'>阅读 0</span>";
            else
                o.readNum="<span style='margin-right:.5rem;'>阅读 "+readNum+"</span>";
            var collectNum= o.collectNum;
            if(!gm.common.isObjUsable(collectNum))
                o.collectNum="<span style='margin-right:.5rem;'>收藏 0</span>";
            else
                o.collectNum="<span style='margin-right:.5rem;'>收藏 "+collectNum+"</span>";
            arr.push(gm.replace(tmp,o));
        });
        return arr.join("");
    }


    initLoad(13);
    initLoad1(15);
    var totalPage=0;
    var itemIndex=0;

    var status = window.location.hash;
    if(status == "#b"){
        $(".btsr,.cvde").removeClass("dmljs1");
        $(".btsr,.cvde").addClass("dmljs");
        $(".clinical_medical").find("span").removeClass("cur").eq(1).addClass("cur");
        $(".clinical_medical").find("b").addClass("recmended");
        $("#tab1").hide();
        $(".pullUpLabel").hide();
        $("#tab2").show();
        $(".pullUpLabel1").show();
        itemIndex=1;
    }else{
        $(".btsr,.cvde").addClass("dmljs1");
        $(".btsr,.cvde").removeClass("dmljs");
        $(".fniortlist .thelatest_zixu").addClass("dospan");
        $(".clinical_medical").find("span").removeClass("cur").eq(0).addClass("cur");
        $("#tab2").hide();
        $(".pullUpLabel1").hide();
        $("#tab1").show();
        $(".pullUpLabel").show();
        itemIndex=0;
    }

    //下拉自动加载数据
    var generatedCount = 1;//页码
    var generatedCount1 = 1;//页码
    /*$(document).ready(function (){
        var nScrollHight = 0; //滚动距离总长(注意不是滚动条的长度)
        var nScrollTop = 0;   //滚动到的当前位置
        var nDivHight = $("#wrapper").height()+$(".diswngu").height()+1;
        var isload=0;//防止多次加载
        $("#wrapper").scroll(function(){
            var that=this;
            nScrollHight = $(this)[0].scrollHeight;
            nScrollTop = $(this)[0].scrollTop;
            if(nScrollTop + nDivHight >= nScrollHight){
                var contentTitle="";
                var _illnessId = $(".illness .lan").length>0?parseInt($(".illness .lan").attr("id")):"";
                if(itemIndex==0){
                    if(isload==0){
                        isload=1;
                        generatedCount++;
                        refreshdata(15,generatedCount,13,contentTitle,_illnessId,function(data){
                            if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                                loadEnd();
                                isload=1;
                            }else{
                                $(".gsid_1 .fnio_thereis").append(bindData(data.value)).collectnews();
                                $(".redmyu").show();
                                isOpenUrl();
                            }

                        });

                    }
                }else if(itemIndex==1){
                    if(isload==0){
                        isload=1;
                        generatedCount1++;
                        refreshdata(15,generatedCount1,15,contentTitle,_illnessId,function(data){
                            if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                                loadEnd1();
                                isload=1;
                            }else{
                                $(".gsid_1 .fnio_thereis1").append(bindData(data.value)).collectnews();
                                $(".redmyu").show();
                                isOpenUrl();
                            }

                        });

                    }
                }
            }else{//恢复加载更多
                isload=0;
            }

        });
    });*/
    /**
     * 初始化滚动加载
     */
    //infinite with navbar
    if($(".user_read")[0]){
        $("#tab1,#tab2").infinite(100).on("infinite", function() {
            var self = this;
            if(self.loading) return;
            self.loading = true;
            setTimeout(function() {
                var contentTitle="";
                var _illnessId = $(".illness .lan").length>0?parseInt($(".illness .lan").attr("id")):"";
                if(itemIndex==0){
                    generatedCount++;
                    refreshdata(15,generatedCount,13,contentTitle,_illnessId,function(data){
                        if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                            $("#tab1").destroyInfinite();
                            $("#tab1 #infinite_load_doctor").html("没有更多数据了！");
                            return ;
                        }else{
                            if(data.value.length<15){
                                $("#tab1").destroyInfinite();
                                $("#tab1 #infinite_load_doctor").html("没有更多数据了！");
                            }
                            $(".gsid_1 .fnio_thereis").append(bindData(data.value)).collectnews();
                            $(".redmyu").show();
                        }

                    });
                }else if(itemIndex==1){
                    generatedCount1++;
                    refreshdata(15,generatedCount1,15,contentTitle,_illnessId,function(data){
                        if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                            $("#tab2 #infinite_load_doctor1").html("没有更多数据了！");
                            $("#tab2").destroyInfinite();
                        }else{
                            if(data.value.length<15){
                                $("#tab2 #infinite_load_doctor1").html("没有更多数据了！");
                                $("#tab2").destroyInfinite();
                            }
                            $(".gsid_1 .fnio_thereis1").append(bindData(data.value)).collectnews();
                            $(".redmyu").show();
                        }

                    });
                }
                self.loading = false;
            }, 1500);   //模拟延迟
        });
    }


    /*if($("#infinite_load_doctor")[0]) {
        var isload = false;
        $("#wrapper").infinite(100).on("infinite", function() {
            if(isload) return;
            isload = true;
            setTimeout(function() {
                var contentTitle="";
                var _illnessId = $(".illness .lan").length>0?parseInt($(".illness .lan").attr("id")):"";
                if(itemIndex==0){
                    if(isload==0){
                        isload=1;
                        generatedCount++;
                        refreshdata(15,generatedCount,13,contentTitle,_illnessId,function(data){
                            if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                                loadEnd();
                                isload=1;
                            }else{
                                $(".gsid_1 .fnio_thereis").append(bindData(data.value)).collectnews();
                                $(".redmyu").show();
                                isOpenUrl();
                            }

                        });

                    }
                }else if(itemIndex==1){
                    if(isload==0){
                        isload=1;
                        generatedCount1++;
                        refreshdata(15,generatedCount1,15,contentTitle,_illnessId,function(data){
                            if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                                loadEnd1();
                                isload=1;
                            }else{
                                $(".gsid_1 .fnio_thereis1").append(bindData(data.value)).collectnews();
                                $(".redmyu").show();
                                isOpenUrl();
                            }

                        });

                    }
                }
                //loadEnd();
                isload = false;
            }, 1000);   //模拟延迟
        });
    }*/


    /**
     * 加载完成
     */
    function loadEnd(){
        console.log("laodend");
        $(".pullUpLabel").html("没有更多信息了！");
    }
    function loadEnd1(){
        console.log("laodend");
        $(".pullUpLabel1").html("没有更多信息了！");
    }
    /**
     * 页面跳转
     */
    function isOpenUrl(){
        $(".isopen").bind({
            touchend:function(e){
                e.preventDefault();
            }
        });
        $(".isopen").ontouch(function(){
                var href = $(this).find("a").attr("href");
                gm.pul.toUrl(href);
            },true
        );
    }

    /**分页功能**/







    /**
     * 阅读页面加载更多时调用
     * @param page 当前页面有多少条记录
     * @param pageno 当前第几页面
     * @param _contentCategoryUuid 所属分类
     * @param contentTitle 筛选title条件
     * @param illnessId 筛选标签index
     * @param callback
     */
    function refreshdata(page,pageno,_contentCategoryUuid,contentTitle,illnessId,callbak){

        getData.getJson({
            page:"content",
            inter:"getArticleInfoList",
            data:{token:token,contentType:_contentCategoryUuid,pageSize:page,pageNum:pageno,collectRule:0,contentTitle:contentTitle||"",illnessId:illnessId||""},
            callback:function(data){
                callbak && callbak(data);
            }
        });
    }
    //分页功能结束
   // onHash();


    function initLoad(type){
        var ____loading = new components.mask("loading");
        ____loading.show();
        //清除选中样式
        $(".aioerk,.suoyou_gj,.illness,.symptom,.entity").find("span").removeClass("lan");
        getData.getJson({
            page:"content",
            inter:"getArticleInfoList",
            data:{token:token,contentType:type,pageSize:15,pageNum:1,collectRule:0,contentTitle:"",illnessId:""},
            callback:function(data){
                ____loading.hide();
                if(data.value==null || data.value.length==0){
                    if($(".scroller").children().hasClass("pullUp")){
                        $(".pullUp").remove();
                    }
                    $(".gsid_1 .fnio_thereis").html("<li style='text-align:center;border:none;background-color: #fafafa;line-height: 50px;'>筛选条件不存在</li>");
                }else{
                    $(".gsid_1 .fnio_thereis").html(bindData(data.value)).collectnews();

                    isOpenUrl();

                }
            }
        });
    }
    function initLoad1(type){
        var ____loading = new components.mask("loading");
        ____loading.show();
        //清除选中样式
        $(".aioerk,.suoyou_gj,.illness,.symptom,.entity").find("span").removeClass("lan");
        getData.getJson({
            page:"content",
            inter:"getArticleInfoList",
            data:{token:token,contentType:type,pageSize:15,pageNum:1,collectRule:0,contentTitle:"",illnessId:""},
            callback:function(data){
                ____loading.hide();
                if(data.value==null || data.value.length==0){
                    if($(".scroller").children().hasClass("pullUp")){
                        $(".pullUp").remove();
                    }
                    $(".gsid_1 .fnio_thereis1").html("<li style='text-align:center;border:none;background-color: #fafafa;line-height: 50px;'>筛选条件不存在</li>");
                }else{
                    $(".gsid_1 .fnio_thereis1").html(bindData(data.value)).collectnews();

                    isOpenUrl();

                }
            }
        });
    }

    //头部切换，内容替换111
    $.fn.clinical_medical_tab = function(){
        var _ = this;
        _.find("span").on("touchend",function(e){
            //清除选中样式
            $(".selctScreenLabel").removeClass("lan");
            e.preventDefault();

            _.find("span").removeClass("cur");
            $(this).addClass("cur");

            window.___index = $(this).index();
            var _class="recmended";

            if(window.___index==0){
                _class="";
                $(".btsr,.cvde").addClass("dmljs1");
                $(".btsr,.cvde").removeClass("dmljs");
                $(".fniortlist .thelatest_zixu").addClass("dospan");
                $(".fniortlist_au").find("div").removeClass("dospan");
                $("#tab2").hide();
                $(".pullUpLabel1").hide();
                $("#tab1").show();
                $(".pullUpLabel").show();
                window.location.hash = "#a";
                itemIndex=0;
                //$("#wrapper").scrollTop(0);//重置top
            }else if (window.___index==1) {
                $(".btsr,.cvde").removeClass("dmljs1");
                $(".btsr,.cvde").addClass("dmljs");
                $(".fniortlist_au .thelatest_zixua").addClass("dospan");
                $(".fniortlist").find("div").removeClass("dospan");
                $("#tab1").hide();
                $(".pullUpLabel").hide();
                $("#tab2").show();
                $(".pullUpLabel1").show();
                window.location.hash = "#b";
                itemIndex=1;
                //$("#wrapper").scrollTop(0);//重置top
            }
            _.find("b").attr("class",_class);
        });
    };

    $("#my_task .filterlayer_a .cancely span").bind({
        touchend:function(){
            gm.pul.toUrl("/html/thedoctorinformation/index.html");
        }
    });



    //隐藏sdc
    //$(".quanzdp").removeClass("sdc");
    //$(".quanzdp").removeClass("sdc1");
    gm.setReturn = function(){
        hidesdc();
    };



    function showsdc(num){
        $(".quanzdp").show();
        $(".ipt-def,.cklamngy form").blur();
        $(".quanzdp:eq("+num+")").addClass("sdc");
        $(".quanzdp:eq("+num+")").removeClass("sdc1");
        gm.pul.returnurl = gm.setReturn;
    }

    function hidesdc(){
        $(".quanzdp").hide();
        $(".quanzdp").removeClass("sdc");
        $(".quanzdp").addClass("sdc1");
        //gm.pul.returnurl = gm.pul.returnIndex;
        gm.isIndex = true;
        gm.pul.returnurl=function(){//退回首页
            if(!gm.isMobile){return;}
            gm.pul.toUrl("goodm://returnIndexPage");
        }
    }

    var _index = 0;

    var fniortlist = function(){

        var _contentCategoryUuid = $(this).attr("contentCategoryUuid");
        //友盟统计-临床推荐
        //_czc.push(["_trackEvent","阅读","临床推荐",$(this).find("span").html(),'',_contentCategoryUuid]);

    };

    //绑定tab 的点击显示 列表
    $(".fniortlist div").bind({
        touchend:fniortlist
    });

    var fniortlist_au = function(){

        var _contentCategoryUuid = $(this).attr("contentCategoryUuid");
        //友盟统计-医学医用
        //_czc.push(["_trackEvent","阅读","医学医用",$(this).find("span").html(),'',_contentCategoryUuid]);
    };

    $(".fniortlist_au div").bind({
        touchend:fniortlist_au
    });

    //查找
    $(".cklamngy .start_find_bnt").bind({
        touchend:function(){
            var _contentCategoryUuid=null;
            if($(".clinical_medical").find("span").eq(1).hasClass("cur"))
                _contentCategoryUuid=15;//专家言论15
            else
                _contentCategoryUuid=13;//最新资讯13
            var _contentName = $(this).prev().val();
            $(".cklamngy input").blur();
            gm.pul.toUrl( "searchresult.html?name="+_contentName+"&contentCategoryUuid="+_contentCategoryUuid+"&token="+token);
        }
    });
    $(".cklamngy input").focus(function(){
        var _contentCategoryUuid=null;
        if($(".clinical_medical").find("span").eq(1).hasClass("cur"))
            _contentCategoryUuid=15;//专家言论15
        else
            _contentCategoryUuid=13;//最新资讯13
        var _contentName ="";
        $(".cklamngy input").blur();
        gm.pul.toUrl( "searchresult.html?name="+_contentName+"&contentCategoryUuid="+_contentCategoryUuid+"&token="+token);
    });
    $(".cklamngy input").bind({
        keyup:function(e){
            var _event = window.event;
            if(event.keyCode == 13){
                var _contentCategoryUuid = $(".cvde .dospan").attr("contentcategoryuuid");
                var _contentName = $(this).val();
                var _illnessId = "";
                var _symptomId = "";
                var _author = "";
                var _entity = "";
                var _country = "";
                // gm.thedoctorinformation.getSearchContentList(_contentCategoryUuid,contentName:_contentName,_illnessId,_symptomId,_author,_entity,_country);
                //友盟统计-搜索
                //_czc.push(["_trackEvent","阅读","搜索关键字",_contentName,'','cklamngy input']);
                $.getDate({
                    page:"content",
                    inter:"getSearchContentList",
                    data:{doctorUuid:gm.user.getDoctor(),contentCategoryUuid:_contentCategoryUuid,contentName:_contentName,illnessId:_illnessId,symptomId:_symptomId,entity:_entity,country:_country,callback:"gm.thedoctorinformation.getSearchContentList"},
                    method:"POST",
                    dataType:"script"
                });
            }
        }
    });

    /*$(".alistodical li").bind({
        touchend:function(){
            $(this).siblings().removeClass("sanmslog");
            $(this).addClass("sanmslog");
        }
    });*/

    $("form").bind({
        submit:function(){
            return false;
        }
    });

    //确定筛选
    $(".sds1 .sdnes b,#filter_btn_sure").bind({
        touchstart:function(){
            $(this).css("opacity","0.5");
        },
        touchend:function(){
            $(this).css("opacity","1.0");
            $(this).siblings("button").removeClass("select_btn");
            hidesdc();

            var _illnessId = $(".illness .lan").length>0?parseInt($(".illness .lan").attr("id")):"";
            var _contentCategoryUuid=13;
            if($(".clinical_medical").find("span").eq(1).hasClass("cur")){
                $("#tab2").scrollTop(0);//重置top
                $("#tab2").infinite();//重新初始化.
                $("#tab2 #infinite_load_doctor1").show();
                generatedCount=1;
                _contentCategoryUuid=15;//专家言论15
                refreshdata(15,generatedCount,_contentCategoryUuid,"",_illnessId,function(data){
                    if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                        $("#tab2 #infinite_load_doctor1").hide();
                        $("#tab2").destroyInfinite();
                        $(".gsid_1 .fnio_thereis1").html("<li style='text-align:center;border:none;background-color: #fafafa;line-height: 50px;'>尝试其他筛选条件试试吧</li>");
                    }else{
                        if(data.value.length<15){
                            $("#tab2 #infinite_load_doctor1").hide();
                            $("#tab2").destroyInfinite();
                        }
                        $(".gsid_1 .fnio_thereis1").html(bindData(data.value)).collectnews();
                        $(".redmyu").show();
                        isOpenUrl();
                    }

                });
            }else{
                $("#tab1").scrollTop(0);//重置top
                $("#tab1").infinite();//重新初始化.
                $("#tab1 #infinite_load_doctor").show();
                generatedCount1=1;
                _contentCategoryUuid=13;//最新资讯13
                refreshdata(15,generatedCount1,_contentCategoryUuid,"",_illnessId,function(data){
                    if(data.value!=undefined && data.value!=null && data.value.length==0){//无数据时
                        $("#tab1 #infinite_load_doctor").hide();
                        $("#tab1").destroyInfinite();
                        $(".gsid_1 .fnio_thereis").html("<li style='text-align:center;border:none;background-color: #fafafa;line-height: 50px;'>尝试其他筛选条件试试吧</li>");
                    }else{
                        if(data.value.length<15){
                            $("#tab1 #infinite_load_doctor").hide();
                            $("#tab1").destroyInfinite();
                        }
                        $(".gsid_1 .fnio_thereis").html(bindData(data.value)).collectnews();
                        $(".redmyu").show();
                        isOpenUrl();
                    }

                });
            }

            return false;
        }
    });

    //搜索重置
    $("#filter_btn_reset").bind({
        touchend:function(){
            $(this).css("opacity","1.0");
            $(this).siblings("button").removeClass("select_btn");
            //清除选中样式
            $(".selctScreenLabel").removeClass("lan");
        },
        touchstart:function(){
            $(this).css("opacity","0.5");
        }
    });
    //确定搜索
    $(".sds2 .sdnes b").bind({
        touchend:function(){
            $(this).siblings("button").removeClass("select_btn");
            $(this).addClass("select_btn");
            $(".fniortlist_au").find("div").removeClass("dospan");
            $(".fniortlist_au").find("div").eq($(".sanmslog").index()).addClass("dospan");
            hidesdc();
            var _contentCategoryUuid = $(".menulist .cur").attr("contentcategoryuuid");
            // var _contentName = "";
            var _illnessId = $(".sds2 .aisieqer .lan").index();//疾病
            // var _symptomId = $(".sds2 .symptom .lan").index() + 1;//量表
            // var _entity = $(".sds2 .aioerk .lan").index() + 1;//医疗标准
            // var _author = "";
            // var _country = $(".sds2 .suoyou_gj .lan").index() + 1;//国家

            var _data = {
                doctorUuid:gm.user.getDoctor(),
                contentCategoryUuid:_contentCategoryUuid,
                illnessId:_illnessId,
                // symptomId:_symptomId,
                // entity:_entity,
                // country:_country,
                callback:"gm.thedoctorinformation.getSearchContentList"
            };
            var _illnessId=0;
            if(_contentCategoryUuid == "A"){
                _data.illnessId = ($(".sds2 .aioerk .lan").length>0?$(".sds2 .aioerk .lan").index() :0);
                _data.country = ($(".sds2 .suoyou_gj .lan").length>0?$(".sds2 .suoyou_gj .lan").index() :0);
            }else if(_contentCategoryUuid == "B"){
                _data.entity = $(".sds2 .aioerk .lan").index() ;
            }else if(_contentCategoryUuid == "C"){
                _data.symptomId = $(".sds2 .aioerk .lan").index() ;
            }
            //筛选后，确定筛选tab
            //友盟统计-医学医用-筛选条件


            window._loading = new components.mask("loading");
            _loading.show();
            $.getDate({
                page:"content",
                inter:"getSearchContentList",
                data:_data,
                method:"POST",
                dataType:"script"
            });
        }
    });

    //切换顶部
    $(".clinical_medical").clinical_medical_tab();

    // 显示遮罩层
    $(".shaixuh").bind({
        touchend:function(){
            showsdc(0);
            //友盟统计-打开搜索次数
            //_czc.push(["_trackEvent","阅读","搜索","打开次数",'','cklamngy .sx1']);
        }
    });

    $(".cklamngy .sx2").bind({
        touchend:function(){
            showsdc(1);
            //友盟统计-打开搜索次数
            //_czc.push(["_trackEvent","阅读","搜索","打开次数",'','cklamngy .sx2']);
        }
    });
    // 隐藏遮罩层
    $(".sdnes h2 span").ontouch(function(){
        hidesdc();
    });

    // 切换
    $("#read .fniortlist div").bind({
        touchend:function(){
//            console.log($(this).index());
            window.location.hash = "#a-" + $(this).index();
            $("#read .fniortlist div").removeClass("dospan");
            $(this).addClass("dospan");

        }
    });


    $("#read .fniortlist_au div").bind({
        touchend:function(){
            window.location.hash = "#b-" + $(this).index();
            $("#read .fniortlist_au div").removeClass("dospan");
            $(this).addClass("dospan");

        }
    });
//获取资讯搜索列表
    function getthedoctorinformation(data){
        window._loading && _loading.hide();
        if(!data){
            components.alert("服务器出错!");
        }
        if(data.query.success=="1"){
            var arr = [];
            var box = $(".gsid_1 ul");
            var _isy = (window.location.href.indexOf("#b") > 0);
            $(data.relist).each(function(i,o){
                o.url = (o.contentType=="3" ? o.contentUrl : 'informationfordetails.html?contentUuid='+o["contentUuid"]+(_isy ? "&action=all" : ""));
                o.contentType = (o.contentType=="3"?"isopen":"");

                arr.push('<li class="'+o.contentType+'" contentUuid="'+o["contentUuid"]+'" favid="' + o["favoriteUuid"] + '"><div class="asbg"><div class="scvideo"><a href="'+o.url+'"><img src="'+(o["imgUrl"] || "/static/imgs/spimg.png")+'"></a></div><div class="videomz">\
			<h2><a href="'+o.url+'">'+o["contentTitle"]+'</a></h2>\
			<p class="contentcount"><span>'+(o["contentCount"]||"0")+'</span>收藏</p></div><div class="clear"></div></div><div class="redmyu">');
                if (o["storeType"] == 1) {
                    arr.push('<i class="icon-redstars"></i><i class="'+(o["shareType"]==0?"icon-mycollection":"icon-mycollection")+'"></i></div><div class="clear"></div></li>');
                }else{
                    arr.push('<i class="icon-greystars"></i><i class="'+(o["shareType"]==0?"icon-mycollection":"icon-mycollection")+'"></i></div><div class="clear"></div></li>');
                }
            });

            box.html(bindData(data.relist)).collectnews();
            $(".redmyu").show();

            $(".isopen").bind({
                touchend:function(e){
                    e.preventDefault();
                }
            });
            $(".isopen").ontouch(function(){
                    var href = $(this).find("a").attr("href");
                    gm.pul.toUrl(href);
                },true
            );
        }else{
            components.alert(data.query.message);
        }
    }

    //获取标签内容 getScreenLabel
    getData.getJson({
        page:"doctor",
        inter:"getScreenLabel",
        data:{},
        method:"get",
        callback:function(data){
            if(data.code=="2000"){
                getScreenLabel(data.value);
            }else{
                components.alert(data.message)
            }
        }
    });
    /**
     *标签标识
     * @param data
     */
    function getScreenLabel(data){
        var arr=[];
        if(data!=undefined && data!=null && data.length>0){
            for(var i=0;i<data.length;i++){
                var tmp="<sapn class='selctScreenLabel' id="+data[i].code+">"+data[i].value+"</sapn>";
                arr.push(tmp);
            }
            $(".illness").html(arr.join(""));
            //绑定事件
            $(".selctScreenLabel").bind({
                touchend:function(){
                    $(this).siblings().removeClass("lan");
                    $(this).addClass("lan");
                }
            });


        }
    }

});